package decisionalalgorithms.guialgorithms.converters;

import com.sun.istack.Nullable;
import decisionalalgorithms.guialgorithms.commands.MatrixBuildDetailsCommand;
import decisionalalgorithms.guialgorithms.domain.MatrixBuildDetails;
import lombok.Synchronized;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class MatrixBuildDetailsToMatrixBuildDetailsCommand implements Converter<MatrixBuildDetails, MatrixBuildDetailsCommand> {
    @Synchronized
    @Nullable
    @Override
    public MatrixBuildDetailsCommand convert(MatrixBuildDetails source) {
        if (source == null) {
            return null;
        }
        final MatrixBuildDetailsCommand matrixBuildDetailsCommand = new MatrixBuildDetailsCommand();
        matrixBuildDetailsCommand.setId(source.getId());
        matrixBuildDetailsCommand.setAlpha(source.getAlpha());
        matrixBuildDetailsCommand.setNumberOfColumns(source.getNumberOfColumns());
        matrixBuildDetailsCommand.setNumberOfRows(source.getNumberOfRows());
        matrixBuildDetailsCommand.setPriority(source.getPriority());
        return matrixBuildDetailsCommand;
    }
}
